package com.lx.video.web;


import com.lx.bean.Result;
import com.lx.video.web.feign.ProductAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("product")
public class Product_feign {

    @Autowired
    ProductAction productAction;

    @Autowired
    RedisTemplate redisTemplate;

    @RequestMapping("getProducts")
    public Result getProducts() {
        Result products = productAction.getProducts();
        redisTemplate.opsForValue().set("products", products);
        return products;
    }

    @RequestMapping("getProductType")
    public Result getProductType() {
        Result productType = productAction.getProductType();
        redisTemplate.opsForValue().set("productType", productType);
        return productType;
    }
}
